'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.CustomErrorType = exports.CustomError = undefined;

var _types = require('./types');

var CustomErrorType = _interopRequireWildcard(_types);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 * 自定义error对象
 * @class CustomError
 * @memberOf fe-lib
 */
var CustomError = function CustomError(message) {
  var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : CustomErrorType.APP;
  var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

  _classCallCheck(this, CustomError);

  this.name = 'CustomError';
  this.message = message;
  this.type = type;
  this.data = data;
};

exports.CustomError = CustomError;
exports.CustomErrorType = CustomErrorType;